package com.taozhugongboy.enumstatemachine.test;

import java.util.ArrayList;
import java.util.List;
import java.util.Random;
import java.util.stream.Collectors;

public class ListBJ {
    public static void main1(String[] args){

        // 创建一个动态数组
        List<String> sites = new ArrayList<>();

        sites.add("Google");
        sites.add("Runoob");
        sites.add("Taobao");

        System.out.println("ArrayList 1: " + sites);

        // 创建另一个动态数组
        List<String> sites2 = new ArrayList<>();

        // 往动态数组中添加元素
        //sites2.add("Wiki");
        //sites2.add("Runoob");
        //sites2.add("Google");
        sites2.add("Google");
        sites2.add("Runoob");
        sites2.add("Taobao");
        System.out.println("ArrayList 2: " + sites2);
        if(sites==sites2){
            System.out.println(true);
        }
        // 保留元素
        Boolean b = sites.retainAll(sites2);
        System.out.println(b);
        System.out.println("保留的元素: " + sites);
    }



    public static void calculateLoan() {
        List netCodeList = new ArrayList<>();
        netCodeList.add(" 1" );
        netCodeList.add(" 1213123" );
        List queryNetCodeList = new ArrayList<>();
        queryNetCodeList.add("0" );
        queryNetCodeList.add("123213123" );
        List unCheckNetCodeList = (List) netCodeList.stream().filter(str -> !queryNetCodeList.contains(str)).collect(Collectors.toList());
        if (null != unCheckNetCodeList && unCheckNetCodeList.size() > 0) {
            System.out.println((unCheckNetCodeList + " 销售机构网点不存在A10037" ));
        }
    }
    public static void calculateLoan11() {
        List userRoleList = new ArrayList<>();
        userRoleList.add("1" );
        userRoleList.add("1213123" );
        List PZRoleList = new ArrayList<>();
        PZRoleList.add("0" );
        PZRoleList.add("1213123" );
        PZRoleList.add("123123124" );
        PZRoleList.add("2134143214" );
        List listJG= (List) userRoleList.stream().filter(str -> PZRoleList.contains(str)).collect(Collectors.toList());
        /*if (null != unCheckNetCodeList && unCheckNetCodeList.size() > 0) {
            System.out.println((unCheckNetCodeList + " 销售机构网点不存在A10037" ));
        }*/
        if(null != listJG && listJG.size() > 0){
            System.out.println(listJG+""+true);
        }
    }

    public static void maincalculateLoan11(String[] args){
        calculateLoan11();
        //createNumber("code");
    }

     static String createNumber(String code){
        //long count=this.count();
         long count=1288834974657L;
        String number=String.format("%04d", count);
         System.out.println(code+number+"-"+new Random().nextInt(99));
        return code+number+"-"+new Random().nextInt(99);
    }

    public static void main1111(String[] args){
        //calculateLoan11();
        long count=11;
        String number=String.format("%06d", count);
        System.out.println("ZY"+number+"-"+new Random().nextInt(99));

    }
    public static void main11(String[] args){
        List PZRoleList = new ArrayList<>();
        PZRoleList.add("中药" );
        PZRoleList.add("手动阀" );
        PZRoleList.add("中药材与中药饮片" );


        System.out.println(PZRoleList.contains("中药饮片"));
    }

    /**
     * glset列表 过滤
     *
     * @author Liuwq
     * @date 2023/08/03
     */
    void listGLSet(){

    }

    public static void main(String[] args) {
        String cacheName = "dict";
        String key = "a_s:1";
        String str =String.format("%s::%s", cacheName, key);
        System.out.println(str);
    }



}
